<?php
/*
 *  Copyright 2011 Eliot Pearson.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 *
 *
 *
 * r[edirect] Monster
 * 
 * A free toolbar to captures traffic on your site for other websites.
 * This app is very useful on Twitter when sharing a link.  Its also very
 * simple to use.
 * 
 * For example:
 * You see a great story on CNN's homepage. You could link to:
 * 
 * http://www.cnn.com 
 * 
 * or you could link to:
 * 
 * http://[yoursite]/rMonster.php?www.cnn.com  
 * 
 * This way you can get traffic and CNN will as well.  Also you can embed a
 * message for anyone clicking the link.  This application will work with
 * URL shorteners.  My blog use bit.ly and the rMonster with no problem.
 * 
 *
 * @author  Eliot Pearson
 * @version 0.0.2
 *
 */

    $qs = $_SERVER["QUERY_STRING"];
    $referer_url = getenv("HTTP_REFERER");

    // Parse with sections
    $ini_array = parse_ini_file("./rMonster.ini", true);

    // Load values from config.
    $site_url = $ini_array['config']['site_url'];
    $site_name = $ini_array['config']['site_name'];
    $message_toolbar = $ini_array['messages']['message_toolbar'];
    $error_iframe = $ini_array['messages']['error_iframe'];

?>
<html>
    <head>
        <!--<link type="image/x-icon" href="http://[site_to_get_here]/favicon.ico" rel="shortcut icon">-->
        <link type="text/css" href="./css/rMonster.css" rel="stylesheet">
    </head>
    <body>
        <table class="mbar">
            <tr>
                <td align="left">Don't forget to visit
                    <a class="mbar" href="<?php echo $site_url ?>">
                        <?php echo $site_name ?>
                    </a>
                </td>
                <td align="right">
                    <a class="mbar" href="http://<?php echo $qs; ?>">
                        <?php echo $message_toolbar ?>
                    </a>
                </td>
            </tr>
        </table>
        <iframe src="http://<?php echo $qs; ?>" frameborder="0"
                style="position: absolute; background: none repeat scroll 0pt 0pt transparent; width: 99%; height: 600px; top: 32px; padding: 0pt; z-index: 1;">
            <p><?php echo $error_iframe ?></p>
        </iframe>
    </body>
</html>
<script type="text/javascript" src="./script/3rdPartyTracking.js"></script>
